home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qregexp.h.z / qregexp.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  2.0 KB  |  73 lines

  1. /****************************************************************************
  2. ** $Id: qregexp.h,v 2.3 1998/07/03 00:09:46 hanord Exp $
  3. **
  4. ** Definition of QRegExp class
  5. **
  6. ** Created : 950126
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QREGEXP_H
  25. #define QREGEXP_H
  26.  
  27. #ifndef QT_H
  28. #include "qstring.h"
  29. #endif // QT_H
  30.  
  31.  
  32. class QRegExp
  33. {
  34. public:
  35.     QRegExp();
  36.     QRegExp( const char *, bool caseSensitive=TRUE, bool wildcard=FALSE );
  37.     QRegExp( const QRegExp & );
  38.    ~QRegExp();
  39.     QRegExp    &operator=( const QRegExp & );
  40.     QRegExp    &operator=( const char *pattern );
  41.  
  42.     bool    operator==( const QRegExp & )  const;
  43.     bool    operator!=( const QRegExp &r ) const
  44.                     { return !(this->operator==(r)); }
  45.  
  46.     bool    isEmpty()    const    { return rxdata == 0; }
  47.     bool    isValid()    const    { return error == 0; }
  48.  
  49.     bool    caseSensitive() const    { return cs; }
  50.     void    setCaseSensitive( bool );
  51.  
  52.     bool    wildcard()    const    { return wc; }
  53.     void    setWildcard( bool );
  54.  
  55.     const char *pattern()    const    { return (const char *)rxstring; }
  56.  
  57.     int        match( const char *str, int index=0, int *len=0 ) const;
  58.  
  59. protected:
  60.     void    compile();
  61.     char       *matchstr( ushort *, char *, char * ) const;
  62.  
  63. private:
  64.     QString    rxstring;            // regular expression pattern
  65.     ushort     *rxdata;                // compiled regexp pattern
  66.     int        error;                // error status
  67.     bool    cs;                // case sensitive
  68.     bool    wc;                // wildcard
  69. };
  70.  
  71.  
  72. #endif // QREGEXP_H
  73.